home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / tools / c2latex.lha / c++2latex / getopt.h < prev    next >
C/C++ Source or Header  |  1993-08-08  |  3KB  |  93 lines

  1. * declarations for getopt
  2.    Copyright (C) 1989 Free Software Foundation, Inc.
  3.  
  4.    This program is free software; you can redistribute it and/or modify
  5.    it under the terms of the GNU General Public License as published by
  6.    the Free Software Foundation; either version 1, or (at your option)
  7.    any later version.
  8.  
  9.    This program is distributed in the hope that it will be useful,
  10.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.    GNU General Public License for more details.
  13.  
  14.    You should have received a copy of the GNU General Public License
  15.    along with this program; if not, write to the Free Software
  16.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  17.  
  18. * For communication from `getopt' to the caller.
  19.    When `getopt' finds an option that takes an argument,
  20.    the argument value is returned here.
  21.    Also, when `ordering' is RETURN_IN_ORDER,
  22.    each non-option ARGV-element is returned here.  */
  23.  
  24. xtern char *optarg;
  25.  
  26. * Index in ARGV of the next element to be scanned.
  27.    This is used for communication to and from the caller
  28.    and for communication between successive calls to `getopt'.
  29.  
  30.    On entry to `getopt', zero means this is the first call; initialize.
  31.  
  32.    When `getopt' returns EOF, this is the index of the first of the
  33.    non-option elements that the caller should itself scan.
  34.  
  35.    Otherwise, `optind' communicates from one call to the next
  36.    how much of ARGV has been scanned so far.  */
  37.  
  38. xtern int optind;
  39.  
  40. * Callers store zero here to inhibit the error message `getopt' prints
  41.    for unrecognized options.  */
  42.  
  43. xtern int opterr;
  44.  
  45. * Describe the long-named options requested by the application.
  46.    _GETOPT_LONG_OPTIONS is a vector of `struct option' terminated by an
  47.    element containing a name which is zero.
  48.    The field `has_arg' is:
  49.    0 if the option does not take an argument,
  50.    1 if the option requires an argument,
  51.    2 if the option takes an optional argument.
  52.    If the field `flag' is nonzero, it points to a variable that is set to
  53.    the value given in the field `val' when the option is found, but
  54.    left unchanged if the option is not found.  */
  55.  
  56. truct option
  57.  
  58.   char *name;
  59.   int has_arg;
  60.   int *flag;
  61.   int val;
  62. ;
  63.  
  64. xtern struct option *_getopt_long_options;
  65.  
  66. * If nonzero, tell getopt that '-' means a long option.
  67.    Set by getopt_long_only.  */
  68. xtern int _getopt_long_only;
  69.  
  70. if 0
  71. * Name of long-named option actually found.
  72.    Only changed when a long-named option is found.
  73.    Set to zero when returning a non-option arg in `optarg'.  */
  74.  
  75. xtern char *_getopt_option_name;
  76. endif
  77.  
  78. * The index in GETOPT_LONG_OPTIONS of the long-named option found.
  79.    Only valid when a long-named option has been found by the most
  80.    recent call to `getopt'.  */
  81.  
  82. xtern int option_index;
  83.  
  84. ifdef __STDC__
  85. nt getopt (int, char **, char *);
  86. nt getopt_long (int, char **, char *, struct option *, int *);
  87. nt getopt_long_only (int, char **, char *, struct option *, int *);
  88. else
  89. nt getopt ();
  90. nt getopt_long ();
  91. nt getopt_long_only ();
  92. endif
  93.